package com.arpa.wms.mapper;

import com.arpa.wms.domain.dto.InventoryOperationDto;
import com.arpa.wms.domain.dto.OutboundRegisterDTO;
import com.arpa.wms.domain.dto.RecheckItemOperationDto;
import com.arpa.wms.domain.entity.OutboundRegister;
import com.arpa.wms.domain.vo.OutboundRegisterVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 出库单明细 Mapper 接口
 * </p>
 *
 * @author LEO
 * @since 2020-10-27
 */
public interface OutboundRegisterMapper extends BaseMapper<OutboundRegister> {

    /**
     * 查询列表
     * @param outboundRegisterDTO
     * @return
     */
    List<OutboundRegisterVO> queryList(OutboundRegisterDTO outboundRegisterDTO);

    /**
     * 查询合计,包含总数
     * @param outboundRegisterDTO
     * @return
     */
    OutboundRegisterVO queryListSum(OutboundRegisterDTO outboundRegisterDTO);

    /**
     * 更新复核数量
     * @author liuxr
     * @date 2021/4/12 18:45
     * @param outboundCode 出库单号
     * @param oldInventoryCode 原库存code
     * @param reviewCount 复核数量
     * @return int 更新条数
     */
    int generalReviewUpdateInfo(@Param("outboundCode") String outboundCode, @Param("oldInventoryCode") String oldInventoryCode, @Param("reviewCount") BigDecimal reviewCount,@Param("groupCode") String groupCode,@Param("updateNotRecheckQuantity")boolean updateNotRecheckQuantity);

    void deliveryCancelUpdataQuantity(@Param("wavePickingCode") String wavePickingCode, @Param("allQuantityList") List<InventoryOperationDto> allQuantityList, @Param("groupCode") String groupCode);

    /**
     * 更新复核数量和状态
     * @author liuxr
     * @date 2021/4/12 18:45
     * @param deliveryDistributionCode 出库单号
     * @param reviewCount 复核数量
     * @return int 更新条数
     */
    int updateRechekQuantityAndStatus(@Param("deliveryDistributionCode") String deliveryDistributionCode,  @Param("reviewCount") BigDecimal reviewCount);

    /**
     * 根据波次号和状态查询列表
     * @param outboundRegisterDTO
     * @return
     */
    List<OutboundRegisterVO> queryListGroupByWavePickingCodeAndStatus(OutboundRegisterDTO outboundRegisterDTO);

    /**
     * 批量更新复核数量
     * @author rfwang
     * @date 2021/12/20 20:12
     * @param recheckItemOperationDtoList
     * @return
     */
    void batchRecheck(List<RecheckItemOperationDto> recheckItemOperationDtoList);

}
